//
//  NSString+Dir.h
//
//  Created by mac on 15/1/11.
//  Copyright (c) 2015年 HYW. All rights reserved.
//

#import "UIView+Extension.h"

@implementation UIView (Extension)

- (void)setX:(CGFloat)x
{
    CGRect frame = self.frame;
    frame.origin.x = x;
    self.frame = frame;
}

- (void)setY:(CGFloat)y
{
    CGRect frame = self.frame;
    frame.origin.y = y;
    self.frame = frame;
}

- (CGFloat)x
{
    return self.frame.origin.x;
}

- (CGFloat)y
{
    return self.frame.origin.y;
}

- (void)setViewCenterX:(CGFloat)viewCenterX
{
//    CGPoint center = self.center;
//    center.x = viewCenterX;
    self.center = CGPointMake(viewCenterX, self.center.y);
}

- (CGFloat)viewCenterX
{
    return self.center.x;
}

- (void)setViewCenterY:(CGFloat)viewCenterY
{
//    CGPoint center = self.center;
//    center.y = viewCenterY;
    self.center = CGPointMake(self.center.x, viewCenterY);
}

- (CGFloat)viewCenterY
{
    return self.center.y;
}

- (void)setViewWidth:(CGFloat)viewwidth
{
    CGRect frame = self.frame;
    frame.size.width = viewwidth;
    self.frame = frame;
}

- (void)setViewHeight:(CGFloat)viewheight
{
    CGRect frame = self.frame;
    frame.size.height = viewheight;
    self.frame = frame;
}

- (CGFloat)viewHeight
{
    return self.frame.size.height;
}

- (CGFloat)viewWidth
{
    return self.frame.size.width;
}

- (void)setSize:(CGSize)size
{
    CGRect frame = self.frame;
    frame.size = size;
    self.frame = frame;
}

- (CGSize)size
{
    return self.frame.size;
}

- (void)setOrigin:(CGPoint)origin
{
    CGRect frame = self.frame;
    frame.origin = origin;
    self.frame = frame;
}

- (CGPoint)origin
{
    return self.frame.origin;
}
- (CGFloat)viewLeft {
    return self.frame.origin.x;
}
- (void)setViewLeft:(CGFloat)viewLeft{
    CGRect frame = self.frame;
    frame.origin.x = viewLeft;
    self.frame = frame;
}
- (CGFloat)viewTop {
    return self.frame.origin.y;
}
-(void)setViewTop:(CGFloat)viewTop {
    CGRect frame = self.frame;
    frame.origin.y = viewTop;
    self.frame = frame;
}
- (CGFloat)viewRight {
    return self.frame.origin.x + self.frame.size.width;
}
- (void)setViewRight:(CGFloat)viewRight {
    CGRect frame = self.frame;
    frame.origin.x = viewRight - frame.size.width;
    self.frame = frame;
}
- (CGFloat)viewBottom {
    return self.frame.origin.y + self.frame.size.height;
}
- (void)setViewBottom:(CGFloat)viewBottom {
    CGRect frame = self.frame;
    frame.origin.y = viewBottom - frame.size.height;
    self.frame = frame;
}

@end
